﻿@using Insya.NetDash

<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="shortcut icon" href="@Url.Content("~/static/img/favicon.ico")">
    <link href="@Url.Content("~/static/css/bootstrap.min.css")" rel=" stylesheet">
    <link href="@Url.Content("~/static/css/style.css")" rel="stylesheet">
    <link href="@Url.Content("~/static/css/dashboard.css")" rel="stylesheet">
    <link href="@Url.Content("~/static/css/signin.css")" rel="stylesheet">
    <link href="@Url.Content("~/static/css/fonts.css")" rel="stylesheet">
    <link href="@Url.Content("~/static/css/font-awesome.css")" rel="stylesheet">
    <link href="@Url.Content("~/static/css/bootstrap-responsive.min.css")" rel="stylesheet">
</head>
<body>
    <a href="https://github.com/yasinkuyu/NetDash"><img style="position: absolute; top: 0; right: 0; border: 0;z-index:99999999;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
    <div class="navbar navbar-fixed-top" style="">
        <div class="navbar-inner">
            <div class="container">
                <a class="brand" href="/">NetDash v @Html.Setting("VERSION")</a>
                <ul class="btn btn-mini">
                    @if (Request.IsAuthenticated)
                    {
                        @Html.ActionLink(Html.Localize("LogOut").ToHtmlString(), "Logout", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
                    }
                    else
                    {
                        @Html.ActionLink(Html.Localize("LogIn").ToHtmlString(), "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
                    }

                </ul>
                <div class="nav-collapse">
                </div>
            </div>
        </div>
    </div>
    <div class="subnavbar visible-desktop visible-tablet">
        <div class="subnavbar-inner">
            <div class="container">
                <ul class="mainnav">
                    <li><a href="#refresh-os"><i class="icon-dashboard"></i><span>@Html.Localize("General")</span> </a> </li>
                    <li><a href="#refresh-df"><i class="icon-hdd"></i><span>@Html.Localize("Disk")</span> </a> </li>
                    <li><a href="#refresh-cpu"><i class="icon-check"></i><span>@Html.Localize("CPU")</span> </a> </li>
                    <li><a href="#refresh-ram"><i class="icon-list-alt"></i><span>@Html.Localize("RAM")</span> </a> </li>
                    <li><a href="#refresh-load"><i class="icon-bolt"></i><span>@Html.Localize("Load")</span> </a> </li>
                    <li><a href="#refresh-online"><i class="icon-user"></i><span>@Html.Localize("Users")</span> </a> </li>
                    <li><a href="#refresh-netstat"><i class="icon-angle-down"></i><span>@Html.Localize("Netstat")</span> </a> </li>
                    <li><a href="#refresh-ispeed"><i class="icon-exchange"></i><span>@Html.Localize("Network")</span> </a> </li>
                    <li><a href="#refresh-ps"><i class="icon-list-alt"></i><span>@Html.Localize("Processes")</span> </a> </li>
                    <li></li>
                </ul>
            </div>
            <!-- /container -->
        </div>
        <!-- /subnavbar-inner -->
    </div>
    <div class="main">
        <div class="main-inner">
            <div class="container">
                @RenderBody()
            </div>
            <!-- /container -->
        </div>
        <!-- /main-inner -->
    </div>
    <!-- /main -->
    <div class="footer">
        <div class="footer-inner">
            <div class="container">
                <div class="row">
                    <div class="span6">&copy; @DateTime.Now.Year by <a href="http://github.com/yasinkuyu">Yasin Kuyu</a> </div>
                    <!-- /span12 -->
                </div>
                <!-- /row -->
            </div>
            <!-- /container -->
        </div>
        <!-- /footer-inner -->
    </div>
    <!-- /footer -->

    <script src="@Url.Content("~/static/js/jquery.js")"></script>
    <script src="@Url.Content("~/static/js/bootstrap.js")"></script>
    <script src="@Url.Content("~/static/js/base.js")"></script>
    <script src="@Url.Content("~/static/js/Chart.min.js")"></script>
    <script src="@Url.Content("~/static/js/jquery.dataTables.min.js")"></script>
    <script>
    // Localize js
    var localize = {
		user : "@Html.Localize("User")",
		domain : "@Html.Localize("Domain")",
		loggedInFrom : "@Html.Localize("LoggedInFrom")",
		count : "@Html.Localize("Count")",
		localIp : "@Html.Localize("LocalIp")",
		localPort : "@Html.Localize("LocalPort")",
		foreing : "@Html.Localize("Foreing")",

		pid : "@Html.Localize("Pid")",
		cpu : "@Html.Localize("Cpu")",
		mem : "@Html.Localize("Mem")",
		start : "@Html.Localize("Start")",
		time : "@Html.Localize("Time")",
		command : "@Html.Localize("Command")",
		unavailable : "@Html.Localize("Unavailable")",

		filesystem : "@Html.Localize("Filsystem")",
		inter_face : "@Html.Localize("Interface")",
		macaddress : "@Html.Localize("Macaddress")",
		ipaddress : "@Html.Localize("Ipaddress")",
		size : "@Html.Localize("Size")",
		used : "@Html.Localize("Usedj")",
		avail : "@Html.Localize("Avail")",
		use : "@Html.Localize("Use")",
		mounted : "@Html.Localize("Mounted")"
	}
    </script>
    <script src="@Url.Content("~/static/js/dashboard.js")"></script>
    <!--[if lte IE 8]>
        <script src="@Url.Content("~/static/js/excanvas.js")"></script>
    <![endif]-->
    <script type="text/javascript">

        var mem_ctx = $("#memoryChart").get(0).getContext("2d");
        var memChart = new Chart(mem_ctx);
        function memory_usage(){
            $.getJSON('/info/memory/', function(data) {
                var options = {
                    animation : false,
                    pointDotRadius : 2,
                    scaleLabel : "<%=value%> Mb"
                }
                memChart.Line(data, options);
            });
        }

        var cpu_ctx = $("#cpuuChart").get(0).getContext("2d");
        var cpuChart = new Chart(cpu_ctx);
        function cpuu_usage(){
            $.getJSON('/info/cpuusage/', function(data) {
                var options = {
                    percentageInnerCutout : 50,
                    segmentStrokeWidth : 0
                }
                cpuChart.Doughnut(data, options);
            });
        }

        var trf_ctx = $("#trfChart").get(0).getContext("2d");
        var trfChart = new Chart(trf_ctx);
        function traffic_usage(){
            $.getJSON('/info/gettraffic/', function(data) {
                var options = {
                    animation : false,
                    pointDotRadius : 2,
                    scaleLabel : "<%=value%>"
                }
                trfChart.Line(data, options);
            });
        }

        var dsk_ctx = $("#dskChart").get(0).getContext("2d");
        var dskChart = new Chart(dsk_ctx);
        function disk_io(){
            $.getJSON('/info/getdiskio/', function(data) {
                var options = {
                    animation : false,
                    pointDotRadius : 2,
                    scaleLabel : "<%=value%>"
                }
                dskChart.Line(data, options);
            });
        }

        var load_ctx = $("#loadChart").get(0).getContext("2d");
        var loadChart = new Chart(load_ctx);
        function load_average(){
            $.getJSON('/info/loadaverage/', function(data) {
                var options = {
                    animation : false,
                    pointDotRadius : 2,
                    scaleLabel : "<%=value%>"
                }
                loadChart.Line(data, options);
            });
        }

        $(function() {
            window.setInterval('dashboard.getProc()', @Html.Setting("TIME_JS_REFRESH_LONG"));
            window.setInterval('memory_usage()', @Html.Setting("TIME_JS_REFRESH"));
            window.setInterval('load_average()', @Html.Setting("TIME_JS_REFRESH"));
            window.setInterval('cpuu_usage()', @Html.Setting("TIME_JS_REFRESH"));
            window.setInterval('traffic_usage()', @Html.Setting("TIME_JS_REFRESH_NET"));
            window.setInterval('disk_io()',@Html.Setting("TIME_JS_REFRESH_NET"));
            window.setInterval('dashboard.getUptime()', @Html.Setting("TIME_JS_REFRESH_LONG"));
            window.setInterval('dashboard.getDisk()', @Html.Setting("TIME_JS_REFRESH_LONG"));
            window.setInterval('dashboard.getUsers()', @Html.Setting("TIME_JS_REFRESH_LONG"));
            window.setInterval('dashboard.getNetstat()', @Html.Setting("TIME_JS_REFRESH_LONG"));
        });

        $(function pageLoad() {
            dashboard.getProc();
            memory_usage();
            load_average();
            cpuu_usage();
            traffic_usage();
            disk_io();
            dashboard.getOSname();
            dashboard.getUptime();
            dashboard.getHostname();
            dashboard.getKernel();
            dashboard.getCPUcount();
            dashboard.getCPUtype();
            dashboard.getDisk();
            dashboard.getUsers();
            dashboard.getNetstat();
            dashboard.getIps();
        });
    </script>
</body>
</html>
